package com.dosen.api.thought.core.provider.controller;

import com.dosen.api.base.common.result.R;
import com.dosen.api.common.result.page.PageUtils;
import com.dosen.api.thought.core.service.entity.SearchConsciousnessEntity;
import com.dosen.api.thought.core.service.service.SearchConsciousnessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;


/**
 *
 *
 * @author zhanggc
 * @email zhangguangcheng@beyondcent.com
 * @date 2023-01-24 15:05:19
 */
@RestController
@RequestMapping("/service/searchconsciousness")
public class SearchConsciousnessController {
    @Autowired
    private SearchConsciousnessService searchConsciousnessService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("service:searchconsciousness:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = searchConsciousnessService.queryPage(params);

        return R.ok().data("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("service:searchconsciousness:info")
    public R info(@PathVariable("id") Long id){
		SearchConsciousnessEntity searchConsciousness = searchConsciousnessService.getById(id);

        return R.ok().data("searchConsciousness", searchConsciousness);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("service:searchconsciousness:save")
    public R save(@RequestBody SearchConsciousnessEntity searchConsciousness){
		searchConsciousnessService.save(searchConsciousness);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("service:searchconsciousness:update")
    public R update(@RequestBody SearchConsciousnessEntity searchConsciousness){
		searchConsciousnessService.updateById(searchConsciousness);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("service:searchconsciousness:delete")
    public R delete(@RequestBody Long[] ids){
		searchConsciousnessService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
